﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Add.aspx.cs" Inherits="WinnerCMS.WebUI.Admin.Category.Add" %>

<%@ Register Src="../UC_AdminSelect.ascx" TagName="UC_AdminSelect" TagPrefix="uc1" %>
<!doctype html>
<html>
<head id="Head1" runat="server">
    <title>添加栏目</title>
    <meta charset="utf-8">
    <meta content="no-cache" http-equiv="Pragma" />
    <%: Scripts.Render("~/Scripts/AdminBase") %>
    <%: Styles.Render("~/Content/Bootstrap/css") %>

    <script type="text/javascript">
        var HtmlSavePath = '/Article/';
        $(function ()
        {
            $("#RBL_URLType input").on('ifChecked', ShowURL); $("#rblCategoryURLType input").on('ifChecked', ShowCategoryURL);
        });
        function ShowURL()
        {
            var a = $get("txtFilePrefix").value;
            var b = $get("txtFilePostfix").value;
            var index;
            var list = document.getElementById("RBL_URLType").getElementsByTagName("INPUT");

            for (var i = 0; i < list.length; i++)
            {
                if (list[i].checked)
                    index = i;
            }

            if (index == 0) {
                $get("show1").innerHTML = HtmlSavePath + "Show/内容ID/页码"; 
            }
            if (index == 1)
            {
                $get("show1").innerHTML = HtmlSavePath + "栏目ID/" + a + "内容ID_页码" + b;
            }
            if (index == 2)
            {
                $get("show1").innerHTML = HtmlSavePath + "200706/" + a + "内容ID_页码" + b;
            }
            if (index == 3)
            {
                $get("show1").innerHTML = HtmlSavePath + "200706/12/" + a + "内容ID_页码" + b;
            }
        }
        function ShowCategoryURL()
        {
            var a = $get("txtCategoryFilePrefix").value;
            var b = $get("txtCategoryFilePostfix").value;

            var index;
            var list = document.getElementById("rblCategoryURLType").getElementsByTagName("INPUT");

            for (var i = 0; i < list.length; i++)
            {
                if (list[i].checked)
                    index = i;
            }

            if (index == 0)
            {
                $get("show2").innerHTML = "Category/栏目ID/页码";
            }
            if (index == 1)
            {
                $get("show2").innerHTML = HtmlSavePath + "栏目ID/" + a + "栏目ID_页码" + b;
            }
            if (index == 2)
            {
                $get("show2").innerHTML = HtmlSavePath + "栏目英文名称/" + a + "栏目ID_页码" + b;
            }
        } 
        function OpenGradeRemark()
        {
            var index;
            var list = document.getElementById("RBL_OpenGrade").getElementsByTagName("INPUT");


            for (var i = 0; i < list.length; i++)
            {
                if (list[i].checked)
                {
                    index = i;
                }
            }

            if (index == 0)
            {
                $get("show3").innerHTML = "游客可以看到该栏目拥有的内容，遇到有权限的内容由内容页进去处理。";
            }
            if (index == 1)
            {
                $get("show3").innerHTML = "游客是看不到含有权限内容的链接，仅能看见免费的内容。";
            }
            if (index == 2)
            {
                $get("show3").innerHTML = "全面禁止游客看到任何内容。";
            }
        } 
        function GetTemplate(controlName)
        {
            $("#dialog-modal").dialog({
                height: 450,
                width: 500,
                title: "网页模板",
                modal: true
            });
            var urlC = $("#dialog-modal-url");
            urlC.attr("src", "../window/GetTemplate.aspx?Control=" + controlName);
            urlC.width(460);
            urlC.height(410);
        }
 
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div id="tabs" class="easyui-tabs">
   
   <div title="基本属性"><table id="Tab0" class="TabelGrid" style="width: 100%">
        <tr>
            <td class="RowTitle">
                所属栏目：
            </td>
            <td>
                <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="ddlCategory_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                绑定模型：</td>
            <td>
                <asp:DropDownList ID="ddlModel" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目名称：
            </td>
            <td>
                <asp:TextBox ID="txtCategoryName" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtCategoryName"
                    ErrorMessage="请输入栏目名称"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目英文名称：
            </td>
            <td>
                <asp:TextBox ID="txtCategoryName_EN" runat="server"></asp:TextBox>
                <br />
                不填写亦可，如果选择了用英文名称作生成HTML规则就会被用到
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目模板：
            </td>
            <td><div class="input-group" style="width: 320px;">
                <asp:TextBox ID="txtTemplateFileName" runat="server" Width="250px" CssClass="form-control"></asp:TextBox><span class="input-group-btn">
                <input class="btn btn-default" type="button" onclick="GetTemplate('txtTemplateFileName');" value="网页模板" /></span></div>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                内容页模板：</td>
            <td><div class="input-group" style="width: 320px;">
                <asp:TextBox ID="txtShowPageTemplateFileName" runat="server" Width="250px" CssClass="form-control"></asp:TextBox>
                <span class="input-group-btn"><input class="btn btn-default" type="button" onclick="GetTemplate('txtShowPageTemplateFileName');" value="网页模板" /></span></div></td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目链接地址：
            </td>
            <td>
                <asp:TextBox ID="txtLinkUrl" runat="server" Width="341px"></asp:TextBox>
                <span class="help-block">
                如果想将栏目链接到外部地址，请输入完整的URL地址，否则请保持为空。</span>
            </td>
        </tr>
    </table></div>
   <div title="权限设置"><table id="Tab1" class="TabelGrid" style="width: 100%">
        <tr>
            <td class="RowTitle">
                内容管理员：
            </td>
            <td>
                <asp:HiddenField ID="hfContentAdmin" runat="server" />
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <uc1:UC_AdminSelect ID="UC_AdminSelect1" runat="server" Visible="true"></uc1:UC_AdminSelect>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目管理员：
            </td>
            <td>
                <asp:HiddenField ID="hfCategoryAdmin" runat="server" />
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <uc1:UC_AdminSelect ID="UC_AdminSelect2" runat="server" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
 
        <tr>
            <td class="RowTitle">
                是否启用投稿：
            </td>
            <td>
                <asp:RadioButtonList ID="RBL_EnableContribute" runat="server" 
                    RepeatDirection="Horizontal" CssClass="icheckboxStyle">
                    <asp:ListItem Value="True" Selected="True">开启</asp:ListItem>
                    <asp:ListItem Value="False">关闭</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                是否启用评论：<br />
                <span style="font-weight: normal">用于录入内容默认值</span>
            </td>
            <td>
                <asp:RadioButtonList ID="RBL_EnableComment" runat="server" 
                    RepeatDirection="Horizontal" CssClass="icheckboxStyle">
                    <asp:ListItem Value="True" Selected="True">开启</asp:ListItem>
                    <asp:ListItem Value="False">关闭</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
    </table></div>
 <div title="URL样式"><table id="Tab2" class="TabelGrid" style="width: 100%">

        <tr>
            <td class="RowTitle">
                内容页静态文件扩展名：
            </td>
            <td>
                <asp:TextBox ID="txtFilePostfix" runat="server">.html</asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                内容页静态文件前缀：
            </td>
            <td>
                <asp:TextBox ID="txtFilePrefix" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                内容页生成规则：
            </td>
            <td>
                <asp:RadioButtonList ID="RBL_URLType" runat="server" RepeatDirection="Horizontal"
                     CssClass="icheckboxStyle" RepeatLayout="Table">
                    <asp:ListItem Value="0" Selected="True">动态</asp:ListItem>
                    <asp:ListItem Value="1">静态规则一</asp:ListItem>
                    <asp:ListItem Value="2">静态规则二</asp:ListItem>
                    <asp:ListItem Value="3">静态规则三</asp:ListItem>
                </asp:RadioButtonList>
                样式预览：<span id="show1"></span>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目静态页扩展名：
            </td>
            <td>
                <asp:TextBox ID="txtCategoryFilePostfix" runat="server" ToolTip=".html">.html</asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目静态页前缀：
            </td>
            <td>
                <asp:TextBox ID="txtCategoryFilePrefix" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目页生成规则：
            </td>
            <td>
                <asp:RadioButtonList ID="rblCategoryURLType" runat="server" RepeatDirection="Horizontal"
                    onclick="ShowCategoryURL();" CssClass="icheckboxStyle">
                    <asp:ListItem Value="0" Selected="True">动态</asp:ListItem>
                    <asp:ListItem Value="1">静态规则一</asp:ListItem>
                    <asp:ListItem Value="2">静态规则二</asp:ListItem>
                </asp:RadioButtonList>
                样式预览：<span id="show2"></span>
            </td>
        </tr>
    </table></div>
 <div title="其他属性"><table id="Tab3" class="TabelGrid" style="width: 100%">
        <tr>
            <td class="RowTitle">
                栏目介绍<br />
                <span style="font-weight: normal">支持HTML</span>
            </td>
            <td>
                <asp:TextBox ID="txtCategoryIntro" runat="server" Height="80px" TextMode="MultiLine"
                    Width="300px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目缩略图
            </td>
            <td>
                <asp:TextBox ID="txtCategoryPic" runat="server" Height="80px" TextMode="MultiLine" Width="300px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目META网页描述
            </td>
            <td>
                <asp:TextBox ID="txtCategoryDescription" runat="server" Height="80px" TextMode="MultiLine"
                    Width="300px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="RowTitle">
                栏目META关键词
            </td>
            <td>
                <asp:TextBox ID="txtCategoryKeyWord" runat="server" Height="80px" Width="300px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
    </table></div>
  <div title="扩展属性"><asp:UpdatePanel ID="UpdatePanel3" runat="server">
        <ContentTemplate>
            <table id="Tab4" class="TabelGrid" style="width: 100%">
                <tr>
                    <td class="RowTitle">
                        拷贝其他类别属性：
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlCopyCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCopyCategory_SelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="RowTitle">
                        扩展属性：
                    </td>
                    <td>
                        <asp:CheckBoxList ID="CBL_Fields" runat="server" RepeatColumns="5" RepeatDirection="Horizontal">
                        </asp:CheckBoxList>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel></div> </div>
    <br />
    <div style="text-align: center">
        <asp:Button ID="btnOK" runat="server" Text="添加" OnClick="btnOK_Click" Cssclass="btn btn-default">
        </asp:Button>
    </div>
    <div id="dialog-modal">
        <iframe id="dialog-modal-url" frameborder="0" scrolling="no"></iframe>
    </div>
    <script type="text/javascript" language="javascript">        ShowURL(); ShowCategoryURL();</script>

    </form>
</body>
</html>